package com.sunyard.inser.web.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.dubbo.config.annotation.DubboReference;

import com.sunyard.inser.dto.PageInfo;
import com.alibaba.dubbo.rpc.cluster.Cluster;
import com.sunyard.inser.dto.DataTablesResult;
import com.sunyard.inser.dto.Result;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sunyard.inser.sys.entity.OrganInfo;
import com.sunyard.inser.sys.service.OrganInfoService;




/**
 * 
 *
 * @author jack
 * @email lif.z@sunyard.com
 * @date 2021-02-08 17:11:43
 */
@RestController
@RequestMapping("sys/organinfo")
public class OrganInfoController {
    
    @DubboReference(check=false,cluster="failfast")
    private OrganInfoService organInfoService;

    /**
         * 列表
     */
    @RequestMapping("/list")
    public DataTablesResult list(@RequestParam Map<String, Object> params){
  	    PageInfo page = new PageInfo();
        return organInfoService.findList(page, params);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{orgId}")
    public Result info(@PathVariable("orgId") Long orgId){
        
		return organInfoService.getById(orgId);

    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody OrganInfo organInfo){
		return organInfoService.create(organInfo);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody OrganInfo organInfo){
		return organInfoService.update(organInfo);
    }
    
   /**
        * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Long orgId){
		return organInfoService.deleteById(orgId);
    }
    

    /**
         *批量删除
     */
    @RequestMapping("/deleteBatch")
    public Result delete(@RequestBody Long[] orgIds){
		return organInfoService.deleteBatch(Arrays.asList(orgIds));
    }

}
